package com.example.team.controller;

import com.example.team.entity.Order;
import com.example.team.service.IOrderService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 编写者：蓝江富
 * 2023年10月30日21:34:13
 */
@RestController
@Api(tags = "劳保订单")
public class OrderController {
    @Autowired
    private IOrderService orderService;

    @ApiOperation(value = "添加劳保订单",
            notes = "成功返回1")
    @RequestMapping("/insertOrder")
    public int insertOrder(Order order){
        return orderService.insertOrder(order);
    }

    @ApiOperation(value = "删除订单",
            notes = "成功返回1")
    @RequestMapping("/deleteOrder")
    public int deleteOrder(Integer id){
        Order order=new Order();
        order.setOrderId(id);
        return orderService.deleteOrder(order);
    }

    @ApiOperation(value = "修改劳保订单信息",
            notes = "成功返回1")
    @RequestMapping("/updateOrder")
    public int updateOrder(Order order){
        return orderService.updateOrder(order);
    }

    @ApiOperation(value = "查询所有劳保订单信息",
            notes = "成功返回Json")
    @RequestMapping("/getAllOrder")
    public List<Order> getAllOrder(Integer applicant){
        Order order=new Order();
        order.setApplicant(applicant);
        return orderService.getAllOrder(order);
    }

    @ApiOperation(value = "查询劳保订单信息",
            notes = "成功返回Json")
    @RequestMapping("/getOrder")
    public Order getOrder(Integer applicant){
        Order order=new Order();
        order.setApplicant(applicant);
        return orderService.getOrder(order);
    }
}
